home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / XAMPP 1.4.14 / xampp-win32-1.4.14-installer.exe / xampp / php / pear / docs / tidy / examples / .tmpcleanhtml.php next >
PHP Script  |  2004-03-24  |  778b  |  38 lines

  1. <?php
  2.  
  3.     /*
  4.      * cleanhtml.php
  5.      *
  6.      * A simple script to clean and repair HTML,XHTML,PHP,ASP,etc. documents
  7.      * if no file is provided, it reads from standard input.
  8.      *
  9.      * By: John Coggeshall <john@php.net>
  10.      *
  11.      * Usage: php cleanhtml.php [filename]
  12.      *
  13.      */
  14.     
  15.     if(!isset($_SERVER['argv'][1])) {
  16.       $data = file_get_contents("php://stdin");
  17.       tidy_parse_string($data);
  18.     } else {
  19.        tidy_parse_file($_SERVER['argv'][1]);
  20.     }
  21.     
  22.     tidy_clean_repair();
  23.     
  24.     if(tidy_warning_count() ||
  25.        tidy_error_count()) {
  26.         
  27.         echo "\n\nThe following errors or warnings occured:\n";
  28.         echo tidy_get_error_buffer();
  29.         echo "\n";
  30.     }
  31.     
  32.     echo tidy_get_output();
  33.     
  34. ?>
  35.     
  36.         
  37.      
  38.